package com.han.school.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.han.school.mapper.TeacherMapper;
import com.han.school.pojo.Teacher;
import com.han.school.service.TeacherService;
import com.han.school.vo.TeacherVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class TeacherServiceImpl implements TeacherService {
    @Autowired
    TeacherMapper teacherMapper;
    @Override
    public PageInfo<TeacherVo> teacherall(TeacherVo teacherVo) {
        PageHelper.startPage(teacherVo.getPage(),teacherVo.getLimit());
        List<TeacherVo> teacherall = teacherMapper.teacherall(teacherVo);
        PageInfo<TeacherVo> teacherVoPageInfo = new PageInfo<>(teacherall);
        return teacherVoPageInfo;
    }


    @Override
    public Integer add(TeacherVo teacherVo) {
        return teacherMapper.add(teacherVo);
    }

    @Override
    public Integer delete(TeacherVo teacherVo) {
        return teacherMapper.delete(teacherVo);
    }

    @Override
    public Integer update(TeacherVo teacherVo) {
        Integer update = teacherMapper.update(teacherVo);
        return update;
    }
}
